package com.letv.core.db;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Environment;
import android.text.TextUtils;

import com.letv.core.constant.LetvConstant;
import com.letv.core.utils.FileUtils;
import com.letv.core.utils.LogInfo;
import com.letv.core.utils.PlayUtils;
import com.letv.core.utils.SharedPreferenceUtils;

public class PreferencesManager {

    private static final String BR_CONTROL = "br_Control";

    private static final String SETTINGS = "settings";

    private static final String PERSONAL_CENTER_SP_NAME = "personal_center";

    private static final String PERSONAL_CENTER_LOGIN_NAME = "personal_login";// 这个是为了退出后保存用户名用的

    private static final String LAST_EXCHANGE_POP_TIME = "LastExchangePopTime";

    private static final String PUSH = "push";

    private static final String CHANNEL_PAGE = "channel_page";

    private static final String SHARE = "share";

    private static final String HOME_PAGE = "home_page";

    private static final String DIALOG_MSG = "dialog_msg";

    private static final String AD_COOKIES = "ad_cookies";

    private static final String API = "API";

    private static final String DOWNLOAD_LOCATION = "download_location";

    private static final String RECOMMEND = "recommend";

    private static final String VERSIONCODE = "versioncode";

    private static final String QZONE = "qzone";

    private static final String POINTS = "points";
    private static final String _POINTS = "_points";

    private static final String PHONE_PAY = "phone_pay";

    private static final String CONTINUE_DISCOUNT = "";

    private static final String HOME_RECOMMEND = "";

    private static final String CRASH_COUNT = "crash_count";

    private static final String PRAISE_USER = "praise_user";

    private static final String _HOME_RECORD = "home_record";

    private static final String LAST_REFRESH_TIME = "last_refresh_time";
    private static final String LAST_HOT_TIME = "last_hot_time";

    private static final String WORLD_CUP_FUNCTION = "world_cup";

    private static final String USER_WO_ORDER = "user_wo_order";

    private static final String INVITE_VISIBLE_FLAG = "false";

    /**
     * 签到
     */
    private static final String ATTENDANCE = "attendance";
    private static final String INVITE_FLAG = "invite_flag";

    /**
     * 是否已经勾选 不再提示“订购流量弹窗”
     * */
    private final static String WO_FLOW_ALERT = "wo_flow_alert";
    private final static String WO_FLOW_ALERT_TIME = "wo_flow_alert_time";

    private final static String PIP_FROM = "pipFrom";

    /**
     * 存储播放器界面的参数，如亮度等
     */
    private static final String PLAYER_PARAMER = "player_parameter";
    /**
     * 观看视频网络变化时是否弹框提示用户
     */
    private static final String DIALOG_3G = "dialog_3g";
    /**
     * 是否弹出点赞未登录的dialog
     * */
    private static final String COMMENT_LIKE_DIALOG = "comment_like_dialog";
    /**
     * 未登录点赞个数
     * */
    private static final String COMMENT_LIKE_COUNT = "comment_like_count";

    private static final int COMMENT_LOGOUT_LIKE_COUNT = 5;
    private static final String PATH = FileUtils.ROOT_FOLDER + "storage/";
    private static final String PATH_DOWNLOAD = PATH + "download";
    private static final String DOWNLOAD_LOCATION_DIR = Environment.getExternalStorageDirectory().getAbsolutePath()
            + "/" + PATH_DOWNLOAD;
    private static final String DOWNLOAD_LOCATION_KEY = "download_location";
    private static final String DOWNLOAD_LOCATION_ISMEMORY_KEY = "download_location_ismem";
    // 强制提醒 start
    private static final String FORCE_ALERT = "force_alert";
    private static final String PREF_LAUNCH_DATE = "pref_launch_date";
    private static final String PREF_LAUNCH_MINUTE = "pref_launch_minute";
    private static final String PREF_CURRENTTIMEMILLIS = "currentTimeMillis";
    private static final String PREF_ALERT_DAYS = "pref_alert_days";

    private static final String LESO_NOTIFICATION = "leso_notification";

    private static final String NOTIFY_ID_LOCAL_FORCE = "notify_id_local_force";

    private static final String BD_LOCATION = "bd_location";

    private static final String USER_PHONE_NUMBER_BIND_STATE = "user_phone_number_bind_state";

    // 下载liteApp的相关设置 by pangzhen
    private static final String LITE_DOWNLOAD = "lite_download";
    private static final String LITE_DOWNLOAD_COMPLETED = "lite_download_completed";
    private static final String LITE_DOWNLOAD_PATH ="lite_download_path" ;
    private static final String LITE_DOWNLOAD_NAME ="lite_download_name" ;
    private static Context context;

    /**
     * 浮球请求数据记录
     */
    private static final String GET_FLAOT_DATA_TIME = "FlaotDataTime";
    /**
     * 浮球活动推荐标识
     */
    private static final String FLOATBALL_ACTIVE_FLAG = "floatball_active_recommend_flag";

    private PreferencesManager(Context context) {
        PreferencesManager.context = context;
    }

    private static PreferencesManager instance;

    public static PreferencesManager getInstance() {
        if (context == null) {
//            instance = new PreferencesManager(BaseApplication.getInstance());
        }
        return instance;
    }

    public static PreferencesManager getInstance(Context context) {
        if (instance == null) {
            instance = new PreferencesManager(context);
        }
        return instance;
    }

    public int getMaxLoading() {
        int maxLoading = (Integer) SharedPreferenceUtils.get(context, SETTINGS, "maxLoading", 3);
        return maxLoading;
    }

    public void setMaxLoading(int maxLoading) {
        SharedPreferenceUtils.put(context, SETTINGS, "maxLoading", maxLoading);
    }

    /**
     * 设置是否跳过片头片尾
     * 
     * @param isSkip
     */
    public void setSkip(boolean isSkip) {
        SharedPreferenceUtils.put(context, SETTINGS, "isSkip", isSkip);
    }

    /**
     * 获取用户的手机号是否已绑定
     * 
     * @return
     */
    public boolean getUserPhoneNumberBindState() {
        boolean hasBinded = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, USER_PHONE_NUMBER_BIND_STATE, false);
        return hasBinded;
    }

    /**
     * 设置用户的手机号是否已绑定
     */
    public void setUserPhoneNumberBindState(boolean hasBinded) {
        SharedPreferenceUtils.put(context, SETTINGS, USER_PHONE_NUMBER_BIND_STATE, hasBinded);
    }

    /**
     * 是否跳过片头片尾 不适用于聊天室
     * 
     * @return
     */
    public boolean isSkip() {
        boolean isSkip = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "isSkip", true);
        return isSkip;
    }

    public void setAllowMobileNetwork(boolean isAllow) {
        SharedPreferenceUtils.put(context, SETTINGS, "isAllow", isAllow);
    }

    public boolean isAllowMobileNetwork() {
        boolean isAllow = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "isAllow", false);
        return isAllow;
    }

    public void setListModel(boolean isList) {
        SharedPreferenceUtils.put(context, SETTINGS, "isList", isList);
    }

    public boolean getListModel() {
        boolean isList = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "isList", true);
        return isList;
    }

    /**
     * @param rate
     * 0，从不 -1 ，总是
     * */
    public void setUpdataRate(int rate) {
        SharedPreferenceUtils.put(context, SETTINGS, "updataRate", rate);
    }

    public int getUpdataRate() {
        int updataRate = (Integer) SharedPreferenceUtils.get(context, SETTINGS, "updataRate", -1);
        return updataRate;
    }

    public void setAutoShare(boolean isAuto) {
        SharedPreferenceUtils.put(context, SETTINGS, "isAuto", isAuto);
    }

    public boolean getAutoShare() {
        boolean isAuto = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "isAuto", false);
        return isAuto;
    }

//    public void notShowNewFeaturesDialog() {
//        SharedPreferenceUtils.put(context, SETTINGS, "isShowNewFeatures", LetvUtils.getClientVersionCode());
//    }

//    public boolean isShowNewFeaturesDialog() {
//        int shortcut = (Integer) SharedPreferenceUtils.get(context, SETTINGS, "isShowNewFeatures", -1);
//        return (shortcut < LetvUtils.getClientVersionCode());
//    }

    public int getSettingVersionCode() {
        int shortcut = (Integer) SharedPreferenceUtils.get(context, SETTINGS, "isShowNewFeatures", -1);
        return shortcut;
    }

    public void setShortcut(boolean shortcut) {
        SharedPreferenceUtils.put(context, SETTINGS, "shortcut", shortcut);
    }

    public boolean getShortcut() {
        boolean shortcut = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "shortcut", true);
        return shortcut;
    }

    /**
     * 搜索快捷键
     * 
     * @param shortcut
     */
    public void setSearchShortcut(boolean shortcut) {
        SharedPreferenceUtils.put(context, SETTINGS, "searchShortcut", shortcut);
    }

    public boolean getSearchShortcut() {
        boolean shortcut = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "searchShortcut", true);
        return shortcut;
    }

    /**
     * 设置是否已经创建快捷方式
     * 
     * @param
     */
    public void setShortCutIcon(boolean isHaveShortIcon) {
        SharedPreferenceUtils.put(context, SETTINGS, "appShortcut", isHaveShortIcon);
    }

    /**
     * 是否已经创建快捷方式
     * 
     * @param
     */
    public boolean getShortCutIcon() {
        return (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "appShortcut", false);

    }

    public void setFirstEnter(boolean isFirstEnter) {
        SharedPreferenceUtils.put(context, SETTINGS, "firstEnter", isFirstEnter);
    }

    public boolean isFirstEnter() {
        boolean isFirstEnter = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "firstEnter", true);
        return isFirstEnter;
    }

    public void setFirstPlay(boolean isFirstEnter) {
        SharedPreferenceUtils.put(context, SETTINGS, "firstPlay", isFirstEnter);
    }

    public boolean isFirstPlay() {
        boolean isFirstEnter = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "firstPlay", true);
        return isFirstEnter;
    }

    public void setIsNeedUpdate(boolean isNeedUpdate) {
        SharedPreferenceUtils.put(context, SETTINGS, "isNeedUpdate", isNeedUpdate);
    }

    public boolean isNeedUpdate() {
        boolean isNeedUpdate = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "isNeedUpdate", false);
        return isNeedUpdate;
    }

    public void setPlayLevel(int isPlayHd) {
        LogInfo.log("zhuqiao", "setPlayLevel" + isPlayHd);
        SharedPreferenceUtils.put(context, SETTINGS, "PlayLevel", isPlayHd);
    }

    public int getPlayLevel() {
        int playLevel =
                (Integer) SharedPreferenceUtils.get(context, SETTINGS, "PlayLevel", PlayUtils.PLAY_LEVEL.HIGH);// 1：极速，2：流畅，3：高清;
        LogInfo.log("zhuqiao", "getPlayLevel" + playLevel);
        return playLevel;
    }

    public void setIsDownloadHd(boolean isPlayHd) {
        SharedPreferenceUtils.put(context, SETTINGS, "isDownloadHd", isPlayHd);
    }

    public boolean isDownloadHd() {
        boolean isPlayHd = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "isDownloadHd", false);
        return isPlayHd;
    }

    public boolean isRecover() {
        boolean isRecover = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "isRecoverNew", false);
        return isRecover;
    }

    public boolean isOperate() {
        boolean isOperate = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "isOperate", false);
        return isOperate;
    }

    public void setIsOperate(boolean isOperate) {
        SharedPreferenceUtils.put(context, SETTINGS, "isOperate", isOperate);
    }

    public void setRecover() {
        SharedPreferenceUtils.put(context, SETTINGS, "isRecoverNew", true);
    }

    /**
     * 是否可以使用摇一摇
     * */
    public boolean isShack() {
        return (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "shack", true);
    }

    /**
     * 设置是否可以使用摇一摇
     * */
    public void setIsShack(boolean isShack) {
        SharedPreferenceUtils.put(context, SETTINGS, "shack", isShack);
    }

    /**
     * 是否云同步过了
     * */
    public boolean isPlayCloud() {
        return (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "playcloud", false);
    }

    /**
     * 设置是否云同步过了
     * */
    public void setisPlayCloud(boolean isShack) {
        SharedPreferenceUtils.put(context, SETTINGS, "playcloud", isShack);
    }

    /**
     * 是否有TV推广
     * */
    public String getTVSpreadData() {
        return (String) SharedPreferenceUtils.get(context, SETTINGS, "TVSpreadData", null);
    }

    /**
     * 是否有TV推广
     * */
    public void setTVSpreadData(String TVSpreadData) {
        SharedPreferenceUtils.put(context, SETTINGS, "TVSpreadData", TVSpreadData);
    }

    /**
     * 得到TV推广markid
     * */
    public String getTVSpreadMark() {
        return (String) SharedPreferenceUtils.get(context, SETTINGS, "TVSpreadMark", null);
    }

    /**
     * 设置TV推广markid
     * */
    public void setTVSpreadMark(String TVSpreadMark) {
        SharedPreferenceUtils.put(context, SETTINGS, "TVSpreadMark", TVSpreadMark);
    }

    /**
     * 保存客户端dialog数据服务端化Markid
     * */
    public void saveDialogMsgMarkid(String markid) {
        SharedPreferenceUtils.put(context, SETTINGS, "dialogMsgMarkid", markid);
    }

    /**
     * 得到客户端dialog数据服务端化Markid
     * */
    public String getDialogMsgMarkid() {
        return (String) SharedPreferenceUtils.get(context, SETTINGS, "dialogMsgMarkid", null);
    }

    /**
     * 设置亮度
     * */
    public void setPlayBrightness(float brightness) {
        SharedPreferenceUtils.put(context, SETTINGS, "Brightness", brightness);
    }

    /**
     * 得到亮度
     * */
    public float getPlayBrightness() {
        return (Float) SharedPreferenceUtils.get(context, SETTINGS, "Brightness", 0.5f);
    }

    /**
     * 视频免费试看时长，单位分钟
     * 
     * @param trailTime
     */
    public void setVipTrailTime(int trailTime) {
        SharedPreferenceUtils.put(context, SETTINGS, "trailTime", trailTime);
    }

    /**
     * 得到视频免费试看时长，单位分钟
     */
    public int getVipTrailTime() {
        int trailTime = (Integer) SharedPreferenceUtils.get(context, SETTINGS, "trailTime", 6);
        return trailTime;
    }

    /**
     * 设置首次进入路上看球标志
     * 
     * @param isFirst
     */
    public void setFirstEnterWorldCup(boolean isFirst) {
        SharedPreferenceUtils.put(context, SETTINGS, "firstEnterWorld", isFirst);
    }

    /**
     * 是否首次进入路上看球
     * 
     * @return
     */
    public boolean isFirstEnterWorldCup() {
        return (Boolean) SharedPreferenceUtils.get(context, SETTINGS, "firstEnterWorld", true);
    }

    /**
     * 点击应用推荐图标时间 格式：20140706
     * */
    public String getClickAppRechangeTime() {
        return (String) SharedPreferenceUtils.get(context, SETTINGS, "clickAppRechangeTime", "");
    }

    /**
     * 获取点击应用推荐图标时间 格式：20140706
     * */
    public void setClickAppRechangeTime(String time) {
        SharedPreferenceUtils.put(context, SETTINGS, "clickAppRechangeTime", time);
    }

    public boolean getCommentLikeDialog() {

        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_PRIVATE);

        boolean isTip = sp.getBoolean(COMMENT_LIKE_DIALOG, true);

        return isTip;
    }

    public boolean getCommentLikeDialogShow() {
        boolean isTip = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, COMMENT_LIKE_DIALOG, true);
        return isTip;
    }

    public void setCommentLikeDialog() {
        boolean isTip = (Boolean) SharedPreferenceUtils.get(context, SETTINGS, COMMENT_LIKE_DIALOG, true);
        SharedPreferenceUtils.put(context, SETTINGS, COMMENT_LIKE_DIALOG, !isTip);
    }

    public boolean isLogoutCommentLikeDialogVisible() {
        int likeCount = (Integer) SharedPreferenceUtils.get(context, SETTINGS, COMMENT_LIKE_COUNT, 0);
        return likeCount < COMMENT_LOGOUT_LIKE_COUNT ? false : getCommentLikeDialog();
    }

    public void setLogoutCommentLikeCount() {
        int likeCount = (Integer) SharedPreferenceUtils.get(context, SETTINGS, COMMENT_LIKE_COUNT, 0);
        likeCount = likeCount % COMMENT_LOGOUT_LIKE_COUNT;
        SharedPreferenceUtils.put(context, SETTINGS, COMMENT_LIKE_COUNT, likeCount + 1);
    }

    public void clearLogoutCommentLikeCount() {
        SharedPreferenceUtils.put(context, SETTINGS, COMMENT_LIKE_COUNT, 0);
    }

    /**
     * 得到push间隔
     */
    public int getPushDistance() {
        SharedPreferences sp = context.getSharedPreferences(PUSH, Context.MODE_MULTI_PROCESS);
        return sp.getInt("distance", 600);
    }

    /**
     * 设置push间隔
     */
    public void savePushDistance(int time) {
        SharedPreferences sp = context.getSharedPreferences(PUSH, Context.MODE_MULTI_PROCESS);
        sp.edit().putInt("distance", time).commit();
    }

    /**
     * 得到上次push时间
     */
    public long getPushTime() {
        SharedPreferences sp = context.getSharedPreferences(PUSH, Context.MODE_MULTI_PROCESS);
        return sp.getLong("time", 0l);
    }

    /**
     * 设置上次push时间
     */
    public void savePushTime(long time) {
        SharedPreferences sp = context.getSharedPreferences(PUSH, Context.MODE_MULTI_PROCESS);
        sp.edit().putLong("time", time).commit();
    }

    /**
     * 得到push id
     */
    public long getPushId() {
        SharedPreferences sp = context.getSharedPreferences(PUSH, Context.MODE_MULTI_PROCESS);
        return sp.getLong("id", 0l);
    }

    /**
     * 设置push id
     */
    public void savePushId(long id) {
        SharedPreferences sp = context.getSharedPreferences(PUSH, Context.MODE_MULTI_PROCESS);
        sp.edit().putLong("id", id).commit();
    }

    /**
     * 得到push msgid
     */
    public String getMsgId() {
        SharedPreferences sp = context.getSharedPreferences(PUSH, Context.MODE_MULTI_PROCESS);
        return sp.getString("msgId", "");
    }

    /**
     * 设置push msgid
     */
    public void saveMsgId(String id) {
        SharedPreferences sp = context.getSharedPreferences(PUSH, Context.MODE_MULTI_PROCESS);
        sp.edit().putString("msgId", id).commit();
    }

    /**
     * 得到push live
     */
    public String getPushLive() {
        SharedPreferences sp = context.getSharedPreferences(PUSH, Context.MODE_MULTI_PROCESS);
        return sp.getString("live", "");
    }

    /**
     * 设置push live
     */
    public void savePushLive(String key) {
        SharedPreferences sp = context.getSharedPreferences(PUSH, Context.MODE_MULTI_PROCESS);
        sp.edit().putString("live", key).commit();
    }

    /**
     * 设置用户名
     * */
    public void setUserName(String username) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "username", username);
    }

    /**
     * 设置用户昵称
     * */
    public void setNickName(String nickname) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "nickname", nickname);
    }

    /**
     * 得到用户手机号
     * */
    public String getUserMobile() {
        return (String) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "mobile", "");
    }

    /**
     * 设置用户手机号
     * */
    public void setUserMobile(String mobile) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "mobile", mobile);
    }

    /**
     * 得到用户名
     * */
    public String getUserName() {
        return (String) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "username", "");
    }

    /**
     * 得到用户昵称
     * */
    public String getNickName() {
        return (String) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "nickname", "");
    }

    /**
     * 设置帐号
     * */
    public void setLoginName(String username) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_LOGIN_NAME, "loginname", username);
    }

    /**
     * 得到帐号
     * */
    public String getLoginName() {
        return (String) SharedPreferenceUtils.get(context, PERSONAL_CENTER_LOGIN_NAME, "loginname", "");
    }

    /**
     * 设置登录密码
     * */
    public void setLoginPassword(String password) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "loginpassword", password);
    }

    /**
     * 得到登录密码
     * */
    public String getLoginPassword() {
        return (String) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "loginpassword", "");
    }

    /**
     * 设置UserID
     * */
    public void setUserId(String userId) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "userId", userId);
    }

    /**
     * 得到UserIcon,v5.3版本 ljnalex 新增
     * */
    public String getUserIcon() {
        return (String) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "userIcon", "");
    }

    /**
     * 设置UserIcon,v5.3版本 ljnalex 新增
     * */
    public void setUserIcon(String userId) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "userIcon", userId);
    }

    /**
     * 得到UserId
     * */
    public String getUserId() {
        return (String) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "userId", "");
    }

    /**
     * 设置SSO_TOKEN
     * */
    public void setSso_tk(String sso_tk) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "sso_tk", sso_tk);
    }

    /**
     * 得到SSO_TOKEN
     * */
    public String getSso_tk() {
        return (String) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "sso_tk", "");
    }

    /**
     * 设置UserID
     * */
    public void setShareUserId(String userId) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "shareUserId", userId);
    }
    
    /**
     * 得到UserId
     * */
    public String getShareUserId() {
        return (String) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "shareUserId", "");
    }

    /**
     * 设置SSO_TOKEN
     * */
    public void setShareToken(String sso_tk) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "share_tk", sso_tk);
    }

    /**
     * 得到SSO_TOKEN
     * */
    public String getShareToken() {
        return (String) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "share_tk", "");
    }
    
    public void setRemember_pwd(boolean isRemember_pwd) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "isRemember_pwd", isRemember_pwd);
    }

    public boolean isRemember_pwd() {
        return (Boolean) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "isRemember_pwd", false);
    }

    public boolean isLogin() {
        return !TextUtils.isEmpty(getUserName()) && !TextUtils.isEmpty(getUserId());
    }

    public void logoutUser() {
        SharedPreferenceUtils.clear(context, PERSONAL_CENTER_SP_NAME);
    }

    /**
     * 设置个人头像右上角泡泡显示状态
     * 
     * @param pop
     */
    public void setColletionPop(boolean pop) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "show_collection_pop", pop);
    }

    /**
     * 获取个人头像右上角泡泡显示状态
     * 
     * @return
     */
    public boolean getColletionPop() {
        return (Boolean) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "show_collection_pop", true);
    }

    /**
     * 第一次进入我的界面
     * 
     * @param first
     */
    public void setFirstInTopMyFragment(boolean first) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "first_in_topmyfragment", first);
    }

    /**
     * 获取 是否是第一次进入我的界面
     * 
     * @return
     */
    public boolean getFirstInTopMyFragment() {
        return (Boolean) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "first_in_topmyfragment", true);
    }

    /**
     * 设置是否是会员
     * */
    public void setVip(boolean isVip) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "vip", isVip);
    }

    /**
     * 是否是会员
     * */
    public boolean isVip() {
        return (Boolean) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "vip", false);
    }

    /**
     * 设置会员过期时间
     * */
    public void setVipCancelTime(long cancelTime) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "cancelTime", cancelTime);
    }

    /**
     * 得到会员取消时间
     * */
    public long getVipCancelTime() {
        return (Long) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "cancelTime", 0L);
    }

    /**
     * 设置高级会员过期时间
     * */
    public void setSeniorVipCancelTime(long cancelTime) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "senior_cancelTime", cancelTime);
    }

    /**
     * 得到高级会员过期时间
     * */
    public long getSeniorVipCancelTime() {
        return (Long) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "senior_cancelTime", 0L);
    }

    /**
     * 得到会员级别
     * */
    public int getVipLevel() {
        return (Integer) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "vipLevel", 0);
    }

    /**
     * 设置会员级别
     * */
    public void setVipLevel(int vipLevel) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "vipLevel", vipLevel);
    }

    /**
     * 设置chkvipday
     * */
    public void setChkvipday(long chkvipday) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "chkvipday", chkvipday);
    }

    /**
     * 得到chkvipday
     * */
    public long getChkvipday() {
        return (Long) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "chkvipday",
                10 * LetvConstant.VIP_OVERDUE_TIME);
    }

    /**
     * 设置lastdays
     * */
    public void setLastdays(long lastdays) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "lastdays", lastdays);
    }

    /**
     * 得到lastdays
     * */
    public long getLastdays() {
        return (Long) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "lastdays",
                10001 * LetvConstant.VIP_OVERDUE_TIME);
    }

    /**
     * 设置uinfo
     */
    public void setUInfo(String uinfo) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "uinfo", uinfo);
    }

    /**
     * 获取uinfo
     */
    public String getUInfo() {
        return (String) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "uinfo", "");
    }

    /*
     * 设置缓存会员过期时间
     */
    public void setCacheCancelTime(long cacheCancelTime) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "cacheCancelTime", cacheCancelTime);
    }

    /*
     * 获取缓存会员过期时间
     */
    public long getCacheCancelTime() {
        return (Long) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "cacheCancelTime", 0L);
    }

    /**
     * 设置currdays
     * */
    public void setCurrdays(long currdays) {
        SharedPreferenceUtils.put(context, PERSONAL_CENTER_SP_NAME, "currdays", currdays);
    }

    /**
     * 得到currdays
     * */
    public long getCurrdays() {
        return (Long) SharedPreferenceUtils.get(context, PERSONAL_CENTER_SP_NAME, "currdays", 1001L);
    }

    public void setUserOrderWo(boolean isOrder) {
        SharedPreferenceUtils.put(context, USER_WO_ORDER, "user_wo", isOrder);
    }

    public boolean getUserOrderWo() {
        return (Boolean) SharedPreferenceUtils.get(context, USER_WO_ORDER, "user_wo", false);
    }

    public void saveChannelsData(String data) {
        SharedPreferenceUtils.put(context, CHANNEL_PAGE, "channels", data);
    }

    public void saveSpecialsData(String data) {
        SharedPreferenceUtils.put(context, CHANNEL_PAGE, "specials", data);
    }

    public String getChannelsData() {
        return (String) SharedPreferenceUtils.get(context, CHANNEL_PAGE, "channels", null);
    }

    public String getSpecialsData() {
        return (String) SharedPreferenceUtils.get(context, CHANNEL_PAGE, "specials", null);
    }

    public boolean sinaIsShare() {
        return (Boolean) SharedPreferenceUtils.get(context, SHARE, "sinaIsShare", true);
    }

    public boolean tencentIsShare() {
        return (Boolean) SharedPreferenceUtils.get(context, SHARE, "tencentIsShare", true);
    }

    public boolean qzoneIsShare() {
        return (Boolean) SharedPreferenceUtils.get(context, SHARE, "qzoneIsShare", true);
    }

    public boolean renrenIsShare() {
        return (Boolean) SharedPreferenceUtils.get(context, SHARE, "renrenIsShare", true);
    }

    public boolean lestarIsShare() {
        return (Boolean) SharedPreferenceUtils.get(context, SHARE, "lestarIsShare", true);
    }

    public void setSinaIsShare(boolean isShare) {
        SharedPreferenceUtils.put(context, SHARE, "sinaIsShare", isShare);
    }

    public void setTencentIsShare(boolean isShare) {
        SharedPreferenceUtils.put(context, SHARE, "tencentIsShare", isShare);
    }

    public void setQzoneIsShare(boolean isShare) {
        SharedPreferenceUtils.put(context, SHARE, "qzoneIsShare", isShare);
    }

    public void setRenrenIsShare(boolean isShare) {
        SharedPreferenceUtils.put(context, SHARE, "renrenIsShare", isShare);
    }

    public void setLestarIsShare(boolean isShare) {
        SharedPreferenceUtils.put(context, SHARE, "lestarIsShare", isShare);
    }

    public void setQQIsShare(boolean isShare) {
        SharedPreferences sp = context.getSharedPreferences(SHARE, Context.MODE_PRIVATE);
        sp.edit().putBoolean("qqIsShare", isShare).commit();
    }

    public boolean qqIsShare() {
        SharedPreferences sp = context.getSharedPreferences(SHARE, Context.MODE_PRIVATE);
        return sp.getBoolean("qqIsShare", true);
    }

    /**
     * 保存首页数据Markid
     * */
    public void saveHomePageMarkid(String markid) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "homepageMarkid", markid);
    }

    /**
     * 得到首页数据Markid
     * */
    public String getHomePageDataMarkid() {
        return (String) SharedPreferenceUtils.get(context, HOME_PAGE, "homepageMarkid", null);
    }

    /**
     * 保存首页推荐数据Markid
     * */
    public void saveHomePageRecommendMarkid(String markid) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "homepageRecommendMarkid", markid);
    }

    /**
     * 得到首页推荐数据Markid
     * */
    public String getHomePageDataRecommendMarkid() {
        return (String) SharedPreferenceUtils.get(context, HOME_PAGE, "homepageRecommendMarkid", null);
    }

    public void saveDialogMsgInfo(String info) {
        SharedPreferenceUtils.put(context, DIALOG_MSG, "dialogMsgInfo", info);
    }

    public String getDialogMsgInfo() {
        return (String) SharedPreferenceUtils.get(context, DIALOG_MSG, "dialogMsgInfo", null);
    }

    public void saveDialogMsgIsSuc(boolean isSuc) {
        SharedPreferenceUtils.put(context, DIALOG_MSG, "dialogMsgInit", isSuc);
    }

    public boolean getDialogMsgIsSuc() {
        return (Boolean) SharedPreferenceUtils.get(context, DIALOG_MSG, "dialogMsgInit", false);
    }

    /**
     * 保存首页JSON数据
     * */
    public void saveHomePageData(String data) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "homepage", data);
    }

    /**
     * 得到首页JSON数据
     * */
    public String getHomePageData() {
        return (String) SharedPreferenceUtils.get(context, HOME_PAGE, "homepage", null);
    }

    /**
     * 保存首页推荐JSON数据
     * */
    public void saveHomePageRecommendData(String data) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "homepageRecommend", data);
    }

    /**
     * 得到首页推荐JJSON数据
     * */
    public String getHomePageRecommendData() {
        return (String) SharedPreferenceUtils.get(context, HOME_PAGE, "homepageRecommend", null);
    }

    /**
     * 保存频道筛选数据Markid
     * */
    public void saveChannelSiftMarkid(String markid) {
        SharedPreferenceUtils.put(context, CHANNEL_PAGE, "channelSiftMarkid", markid);
    }

    /**
     * 得到频道筛选数据Markid
     * */
    public String getChannelSiftMarkid() {
        return (String) SharedPreferenceUtils.get(context, CHANNEL_PAGE, "channelSiftMarkid", null);
    }

    /**
     * 保存频道筛选JSON数据
     * */
    public void saveChannelSiftData(String markid) {
        SharedPreferenceUtils.put(context, CHANNEL_PAGE, "channelSift", markid);
    }

    /**
     * 得到频道筛选JSON数据
     * */
    public String getChannelSiftData() {
        return (String) SharedPreferenceUtils.get(context, CHANNEL_PAGE, "channelSift", null);
    }

    /**
     * 推送是否开启
     * */
    public boolean isPush() {
        return (Boolean) SharedPreferenceUtils.get(context, SHARE, "isPush", true);
    }

    /**
     * 设置是否开启推送
     * */
    public void setIsPush(boolean isPush) {
        SharedPreferenceUtils.put(context, SHARE, "isPush", isPush);
    }

    public void setTransferCookies(String transfer_cookies) {
        SharedPreferenceUtils.put(context, AD_COOKIES, "transfer_cookies", transfer_cookies);
    }

    public String getTransferCookies() {
        return (String) SharedPreferenceUtils.get(context, AD_COOKIES, "transfer_cookies", "");
    }

    /**
     * 是否使用测试接口
     * */
    public boolean isTestApi() {
        return (Boolean) SharedPreferenceUtils.get(context, API, "test", false);
    }

    /**
     * 设置是否使用测试接口
     * */
    public void setTestApi(boolean isTest) {
        SharedPreferenceUtils.put(context, API, "test", isTest);
    }

    public boolean hasUpdateMulti() {
        return (Boolean) SharedPreferenceUtils.get(context, API, "update_to_multi", false);
    }

    public void updateMulti() {
        SharedPreferenceUtils.put(context, API, "update_to_multi", true);
    }

    public boolean isUpdateLiveBook() {
        return (Boolean) SharedPreferenceUtils.get(context, PUSH, "isUpdateLiveBook", true);
    }

    public void setIsUpdateLiveBook(boolean isUpdateLiveBook) {
        SharedPreferenceUtils.put(context, PUSH, "isUpdateLiveBook", isUpdateLiveBook);
    }

    public boolean isLiveRemind() {
        return (Boolean) SharedPreferenceUtils.get(context, PUSH, "isLiveRemind", true);
    }

    public void setIsLiveRemind(boolean isLiveRemind) {
        SharedPreferenceUtils.put(context, PUSH, "isLiveRemind", isLiveRemind);
    }

    /**
     * 得到默认现在路径
     * */
    public String getDownloadLocation() {
        return (String) SharedPreferenceUtils.get(context, PUSH, DOWNLOAD_LOCATION, DOWNLOAD_LOCATION_DIR);
    }

    /**
     * 设置下载路径
     * */
    public void setDownloadLocation(String path) {
        SharedPreferenceUtils.put(context, DOWNLOAD_LOCATION, DOWNLOAD_LOCATION, path);
    }

    /**
     * 设置推荐位的推荐数量
     * */
    public void setRecommendNum(int num) {
        SharedPreferenceUtils.put(context, RECOMMEND, "num", num);
    }

    /**
     * 推荐位的推荐数量
     * */
    public int getRecommendNum() {
        return (Integer) SharedPreferenceUtils.get(context, RECOMMEND, "num", 0);
    }

    /**
     * 是否弹出过腾讯管家下载提示
     * */
    public boolean isPopTencentDialog() {
        return (Boolean) SharedPreferenceUtils.get(context, HOME_PAGE, "isPop", false);
    }

    /**
     * 设置腾讯管家下载提示
     * */
    public void setisPopTencentdialog(boolean isPop) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "isPop", isPop);
    }

    /**
     * 得到当前开机图的order
     * */
    public int getCurBootingOrder() {
        return (Integer) SharedPreferenceUtils.get(context, HOME_PAGE, "bootingOrder", 0);
    }

    /**
     * 设置当前开机图的order
     * */
    public void setCurBootingOrder(int order) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "bootingOrder", order);
    }

    /**
     * 首页精品推荐控制
     * 开关：true-开，false-关
     * */
    public void setBottomRecommendSwitch(boolean isOpen) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "bottomrecommendswitch", isOpen);
    }

    /**
     * 获取首页精品推荐控制
     * 开关：true-开，false-关
     * */
    public boolean getBottomRecommendSwitch() {
        return (Boolean) SharedPreferenceUtils.get(context, HOME_PAGE, "bottomrecommendswitch", false);
    }

    /**
     * 频道精品推荐控制
     * 开关：true-开，false-关
     * */
    public void setChannelRecommendSwitch(boolean isOpen) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "channelrecommendswitch", isOpen);
    }

    /**
     * 获取频道精品推荐控制
     * 开关：true-开，false-关
     * */
    public boolean getChannelRecommendSwitch() {
        return (Boolean) SharedPreferenceUtils.get(context, HOME_PAGE, "channelrecommendswitch", false);
    }

    /**
     * 首页应用弹窗推荐开关
     * 开关：true-开，false-关
     * */
    public void setPopRecommendSwitch(boolean isOpen) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "poprecommendswitch", isOpen);
    }

    /**
     * 获取首页应用弹窗推荐开关
     * 开关：true-开，false-关
     * */
    public boolean isPopRecommendSwitch() {
        return (Boolean) SharedPreferenceUtils.get(context, HOME_PAGE, "poprecommendswitch", false);
    }

    /**
     * 频道世界杯控制
     * */
    public void setChannelWorldCupSwitch(boolean isOpen) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "channelWorldCupswitch", isOpen);
    }

    /**
     * 获取频道世界杯控制
     * */
    public boolean getChannelWorldCupSwitch() {
        return (Boolean) SharedPreferenceUtils.get(context, HOME_PAGE, "channelWorldCupswitch", false);
    }

    /**
     * 杜比频道提示
     * */
    public void setDoublySwitch(boolean isFirst) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "doublyswitch", isFirst);
    }

    /**
     * 杜比频道提示
     * */
    public boolean getDoublySwitch() {
        return (Boolean) SharedPreferenceUtils.get(context, HOME_PAGE, "doublyswitch", false);
    }

    /**
     * 首页logo运营信息
     * */
    public void setLogoInfo(boolean status) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "logoInfo", status);
    }

    /**
     * 得到首页logo运营信息
     * */
    public boolean getLogoInfo() {
        return (Boolean) SharedPreferenceUtils.get(context, HOME_PAGE, "logoInfo", false);
    }

    /**
     * JpushInfo运营信息
     * */
    public void setJpushInfo(boolean status) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "JpushInfo", status);
    }

    /**
     * JpushInfo运营信息
     * */
    public boolean getJpushInfo() {
        return (Boolean) SharedPreferenceUtils.get(context, HOME_PAGE, "JpushInfo", false);
    }

    /**
     * Utp运营信息
     * */
    public void setUtp(boolean status) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "utp", status);
    }

    /**
     * 得到Utp运营信息
     * */
    public boolean getUtp() {
        // return false;
        return (Boolean) SharedPreferenceUtils.get(context, HOME_PAGE, "utp", false);
    }

    /**
     * 联通合作开关
     * 开关：true-开，false-关
     * */
    public void setChinaUnicomSwitch(boolean isOpen) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "china_unicom", isOpen);
    }

    /**
     * 联通合作开关
     * 开关：true-开，false-关
     * */
    public boolean isChinaUnicomSwitch() {
        return (Boolean) SharedPreferenceUtils.get(context, HOME_PAGE, "china_unicom", true);
        // return false;
    }

    /**
     * LinkShell加密开关
     * 开关：true-开，false-关
     * */
    public void setLinkShellSwitch(boolean isOpen) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "link_shell", isOpen);
    }

    /**
     * LinkShell加密开关
     * 开关：true-开，false-关
     * */
    public boolean isLinkShellSwitch() {
        return (Boolean) SharedPreferenceUtils.get(context, HOME_PAGE, "link_shell", true);
    }

    /**
     * mp4_utp开关
     * 开关：true-开，false-关
     * */
    public void setMP4UtpSwitch(boolean isOpen) {
        SharedPreferenceUtils.put(context, HOME_PAGE, "mp4_utp", isOpen);
    }

    /**
     * mp4_utp开关
     * 开关：true-开，false-关
     * */
    public boolean isMP4UtpSwitch() {
        return (Boolean) SharedPreferenceUtils.get(context, HOME_PAGE, "mp4_utp", false);
    }

    /**
     * 关闭播放码流控制
     * */
//    public void closePlayBrControl() {
//        SharedPreferenceUtils.put(context, BR_CONTROL, "play_control", LetvUtils.getClientVersionCode());
//    }

    /**
     * 播放码流控制是否已经关闭
     * */
//    public boolean playBrControlIsClose() {
//        int play_control = (Integer) SharedPreferenceUtils.get(context, BR_CONTROL, "play_control", 0);
//        return play_control == LetvUtils.getClientVersionCode();
//    }

    /**
     * 关闭下载码流控制
     * */
//    public void closeDownloadBrControl() {
//        SharedPreferenceUtils.put(context, BR_CONTROL, "download_control", LetvUtils.getClientVersionCode());
//    }

    /**
     * 下载码流控制是否已经关闭
     * */
//    public boolean downloadBrControlIsClose() {
//        int download_control = (Integer) SharedPreferenceUtils.get(context, BR_CONTROL, "download_control", 0);
//        return download_control == LetvUtils.getClientVersionCode();
//    }

    /**
     * 设置下载350码流名称
     * */
//    public void setDownloadLow_zh(String name) {
//        SharedPreferenceUtils.put(context, BR_CONTROL, "low_download_zh", name);
//    }

    /**
     * 得到下载350码流名称
     * */
//    public String getDownloadLow_zh() {
//        String dn = "流畅";
//        String name = (String) SharedPreferenceUtils.get(context, BR_CONTROL, "low_download_zh", dn);
//        if (TextUtils.isEmpty(name)) {
//            name = dn;
//        }
//        return name;
//    }

    /**
     * 设置下载1000码流名称
     * */
//    public void setDownloadNormal_zh(String name) {
//        SharedPreferenceUtils.get(context, BR_CONTROL, "normal_download_zh", name);
//    }

    /**
     * 得到下载1000码流名称
     * */
//    public String getDownloadNormal_zh() {
//        String dn = "高清";
//        String name = (String) SharedPreferenceUtils.get(context, BR_CONTROL, "normal_download_zh", dn);
//        if (TextUtils.isEmpty(name)) {
//            name = dn;
//        }
//        return name;
//    }

    /**
     * 设置下载1300码流名称
     * */
//    public void setDownloadHigh_zh(String name) {
//        SharedPreferenceUtils.put(context, BR_CONTROL, "high_download_zh", name);
//    }

    /**
     * 得到下载1300码流名称
     * */
//    public String getDownloadHigh_zh() {
//        String dn = "超清";
//        String name = (String) SharedPreferenceUtils.get(context, BR_CONTROL, "high_download_zh", dn);
//        if (TextUtils.isEmpty(name)) {
//            name = dn;
//        }
//        return name;
//    }

    /**
     * 设置播放160码流名称
     * */
//    public void setPlaySuperSpeed_zh(String name) {
//        SharedPreferenceUtils.put(context, BR_CONTROL, "superSpeed_play_zh", name);
//    }

    /**
     * 得到下载160码流名称
     * */
//    public String getPlaySuperSpeed_zh() {
//        String dn = "极速";
//        String name = (String) SharedPreferenceUtils.get(context, BR_CONTROL, "superSpeed_play_zh", dn);
//        if (TextUtils.isEmpty(name)) {
//            name = dn;
//        }
//        return name;
//    }

    /**
     * 设置播放350码流名称
     * */
//    public void setPlayLow_zh(String name) {
//        SharedPreferenceUtils.put(context, BR_CONTROL, "low_play_zh", name);
//    }

    /**
     * 得到下载350码流名称
     * */
//    public String getPlayLow_zh() {
//        String dn = "流畅";
//        String name = (String) SharedPreferenceUtils.get(context, BR_CONTROL, "low_play_zh", dn);
//        if (TextUtils.isEmpty(name)) {
//            name = dn;
//        }
//        return name;
//    }

    /**
     * 设置下载1000码流名称
     * */
//    public void setPlayNormal_zh(String name) {
//        SharedPreferenceUtils.put(context, BR_CONTROL, "normal_play_zh", name);
//    }

    /**
     * 得到下载1000码流名称
     * */
//    public String getPlayNormal_zh() {
//        String dn = "高清";
//        String name = (String) SharedPreferenceUtils.get(context, BR_CONTROL, "normal_play_zh", "高清");
//        if (TextUtils.isEmpty(name)) {
//            name = dn;
//        }
//        return name;
//    }

    /**
     * 设置下载1300码流名称
     * */
//    public void setPlayHigh_zh(String name) {
//        SharedPreferenceUtils.put(context, BR_CONTROL, "high_play_zh", name);
//    }

    /**
     * 得到下载1300码流名称
     * */
//    public String getPlayHigh_zh() {
//        String dn = "超清";
//        String name = (String) SharedPreferenceUtils.get(context, BR_CONTROL, "high_play_zh", dn);
//        if (TextUtils.isEmpty(name)) {
//            name = dn;
//        }
//        return name;
//    }

    /**
     * 设置m3v
     * */
//    public void setM3v(String m3v) {
//        if (!TextUtils.isEmpty(m3v)) {
//            SharedPreferenceUtils.put(context, BR_CONTROL, "m3v", m3v);
//        }
//    }

    /**
     * 得到下载1300码流名称
     * */
    public String getM3v() {
        return (String) SharedPreferenceUtils.get(context, BR_CONTROL, "m3v", "3");
    }

    /**
     * 保存版本号到本地。
     */
    public void setVersionCode(int VersionCodeId) {
        SharedPreferenceUtils.put(context, VERSIONCODE, "VersionCodeId", VersionCodeId);
    }

    /**
     * 
     * 获取保存的版本号
     */
    public int getVersionCode() {
        return (Integer) SharedPreferenceUtils.get(context, VERSIONCODE, "VersionCodeId", 0);
    }

    /******************************************** QZone分享 ********************************************/
    /**
     * 保存QZone登录信息
     * 
     * @param openid
     * @param access_token
     * @param expires_in
     */
//    public void saveQZoneLogin(String openid, String access_token, String expires_in) {
//        SharedPreferences preferences = context.getSharedPreferences("qzone", Context.MODE_PRIVATE);
//        Editor editor = preferences.edit();
//        editor.putString("openid", openid);
//        editor.putString("access_token", access_token);
//        editor.putString("expires_in", expires_in);
//        editor.commit();
//    }

    /**
     * 返回长度为3的数组，第一个是openid，第二个是access_token，第三个是expires_in
     * 
     * @return
     */
//    public String[] getQZoneLogin() {
//        SharedPreferences preferences = context.getSharedPreferences("qzone", Context.MODE_PRIVATE);
//        String[] result = new String[3];
//        result[0] = preferences.getString("openid", "");
//        result[1] = preferences.getString("access_token", "");
//        result[2] = preferences.getString("expires_in", "");
//        return result;
//    }

    /**
     * 清楚QZone登录信息
     */
//    public void clearQZoneLogin() {
//        SharedPreferences preferences = context.getSharedPreferences("qzone", Context.MODE_PRIVATE);
//        preferences.edit().clear().commit();
//    }

    /******************************************** QZone分享 end ********************************************/
    /**
     * 设置应用弹窗时间
     * */
//    public void setLastExchangePopTime(long currdays) {
//        SharedPreferenceUtils.put(context, LAST_EXCHANGE_POP_TIME, "LastExchangePopTime", currdays);
//    }

    /**
     * 得到应用弹窗时间
     * */
//    public long getLastExchangePopTime() {
//        return (Long) SharedPreferenceUtils.get(context, LAST_EXCHANGE_POP_TIME, "LastExchangePopTime", 0L);
//    }

    // 登录获取满积分的时间
    public void setPointsLoginGainDate(String date) {
        SharedPreferenceUtils.put(context, POINTS, "login_date", date);
    }

    public String getPointsLoginGainDate() {
        return (String) SharedPreferenceUtils.get(context, POINTS, "login_date", "");
    }

    // 观看视频获取满积分的时间
    public void setPointsVideoGainDate(String date) {
        SharedPreferenceUtils.put(context, POINTS, "video_date", date);
    }

    public String getPointsVideoGainDate() {
        return (String) SharedPreferenceUtils.get(context, POINTS, "video_date", "");
    }

    // 分享视频获取满积分的时间
    public void setPointsShareGainDate(String date) {
        SharedPreferenceUtils.put(context, POINTS, "share_date", date);
    }

    public String getPointsShareGainDate() {
        return (String) SharedPreferenceUtils.get(context, POINTS, "share_date", "");
    }

    // 观看视频获取满积分的时间
//    public void setPointsVideoPoints(int points) {
//        SharedPreferenceUtils.put(context, _POINTS, "video_points", points);
//    }

//    public int getPointsVideoPoints() {
//        return (Integer) SharedPreferenceUtils.get(context, _POINTS, "video_points", 0);
//    }

    // 分享视频获取满积分的时间
//    public void setPointsSharePoints(int points) {
//        SharedPreferenceUtils.put(context, _POINTS, "share_points", points);
//    }

//    public int getPointsSharePoints() {
//        return (Integer) SharedPreferenceUtils.get(context, _POINTS, "share_points", 0);
//    }

    /**
     * 从开机接口中获取是否显示手机话费支付
     * 
     * @param show
     */
//    public void setShowPhonePay(boolean show) {
//        SharedPreferenceUtils.put(context, PHONE_PAY, "show_phone_pay", show);
//    }

    /**
     * 是否显示手机话费支付
     * 
     * @return
     */
//    public boolean isShowPhonePay() {
//        return (Boolean) SharedPreferenceUtils.get(context, PHONE_PAY, "show_phone_pay", PreferencesManager
//                .getInstance().isTestApi());
//    }

    /**
     * 续费期优惠
     * 
     * @param userId
     */
//    public void setContinueDiscount(String userId, String price) {
//        if (TextUtils.isEmpty(userId)) {
//            return;
//        }
//        SharedPreferenceUtils.put(context, CONTINUE_DISCOUNT, userId + "_continue_discount", price);
//    }

    /**
     * 续费期优惠
     * 
     * @return
     */
//    public String getContinueDiscount(String userId) {
//        if (TextUtils.isEmpty(userId)) {
//            return "0";
//        }
//        return StringUtils.subZeroAndDot((String) SharedPreferenceUtils.get(context, CONTINUE_DISCOUNT, userId
//                + "_continue_discount", "0"));
//    }

//    private void cleanContinueDiscount(String userId) {
//        SharedPreferenceUtils.remove(context, CONTINUE_DISCOUNT, userId + "_continue_discount");
//    }

    /**
     * 首页推荐
     */
//    public void saveRecommend(String recommend) {
//
//        if (TextUtils.isEmpty(recommend)) {
//            return;
//        }
//        SharedPreferenceUtils.put(context, HOME_RECOMMEND, "recommend", recommend);
//    }

    public String getRecommend() {
        return (String) SharedPreferenceUtils.get(context, HOME_RECOMMEND, "recommend", null);
    }

    // 崩溃次数
    public void setCrashCount(int count) {
        SharedPreferenceUtils.put(context, CRASH_COUNT, "crash", count);
    }

    public int getCrashCount() {
        return (Integer) SharedPreferenceUtils.get(context, CRASH_COUNT, "crash", 0);
    }

    /**
     * 升级下载APP 送会员
     */
//    public void savePraise(boolean praise) {
//        SharedPreferenceUtils.put(context, PRAISE_USER, "praise_kit", praise);
//    }

//    public boolean getPraise() {
//        return (Boolean) SharedPreferenceUtils.get(context, PRAISE_USER, "praise_kit", false);
//    }

//    public void saveHomeRecord(String name) {
//        SharedPreferenceUtils.put(context, _HOME_RECORD, "my_home_record", name);
//    }

//    public String getHomeRecord() {
//        return (String) SharedPreferenceUtils.get(context, _HOME_RECORD, "my_home_record", "");
//    }

    /**
     * 
     * @param title:新式下来刷新样式的页面title，必须是唯一的：homeFragment-->首页
     * @param time:本次下拉刷新的时间
     */
//    public void saveLastRefreshTime(String title, String time) {
//        SharedPreferenceUtils.put(context, LAST_REFRESH_TIME, title, time);
//    }

//    public String getLastRefreshTime(String title) {
//        String temp = (String) SharedPreferenceUtils.get(context, LAST_REFRESH_TIME, title, "" + 1);
//        return temp;
//    }

//    public void saveHotLastTime(String hot) {
//        SharedPreferenceUtils.put(context, LAST_HOT_TIME, "last_time_refresh_hot", hot);
//    }

//    public String getHotLastTime() {
//        String temp = (String) SharedPreferenceUtils.get(context, LAST_HOT_TIME, "last_time_refresh_hot", "");
//        return temp;
//    }

//    public void setWorldCupStartTime(String startTime) {
//        SharedPreferenceUtils.put(context, WORLD_CUP_FUNCTION, "world_cup_start_time", startTime);
//    }

//    public void setWorldCupEndTime(String endTime) {
//        SharedPreferenceUtils.put(context, WORLD_CUP_FUNCTION, "world_cup_end_time", endTime);
//    }

    /**
     * 设置口袋看球推送文案
     * 
     * @param pushText
     */
    public void setWorldCupPushText(String pushText) {
        SharedPreferenceUtils.put(context, WORLD_CUP_FUNCTION, "pushText", pushText);
    }

    /**
     * 设置下载路劲
     * 
     * @param path
     * @param isMemory
     * true:手机存储;false:SD卡
     */
    public void setDownloadLocation(String path, boolean isMemory) {
        if (TextUtils.isEmpty(path)) {
            return;
        }
        SharedPreferences sp = context.getSharedPreferences(PUSH, Context.MODE_PRIVATE);
        sp.edit().putString(DOWNLOAD_LOCATION_KEY, path).commit();
        sp.edit().putBoolean(DOWNLOAD_LOCATION_ISMEMORY_KEY, isMemory).commit();
    }

    /**
     * 
     * @param key
     * @param value
     * int类型 ，下载的标记
     */
//    public void setDownloadLocation(String key, int value) {
//        SharedPreferenceUtils.put(context, PUSH, key, value);
//    }

    /**
     * 保存签到缓存数据
     * 
     * @param jsonData json数据
     * @param time 保存数据的时间
     */
//    public void setAttendanceCacheData(String jsonData, long time) {
//        SharedPreferences sp = context.getSharedPreferences(ATTENDANCE, Context.MODE_PRIVATE);
//        Editor editor = sp.edit();
//        editor.putString("jsonData", jsonData);
//        editor.putLong("time", time);
//        editor.commit();
//    }

    /**
     * 读取签到缓存数据
     * 
     * @return
     */
//    public String getAttendanceCacheData() {
//        return (String) SharedPreferenceUtils.get(context, ATTENDANCE, "jsonData", "");
//    }

    /**
     * 读取签到缓存数据
     * 
     * @return
     */
//    public long getAttendanceCacheTime() {
//        return (Long) SharedPreferenceUtils.get(context, ATTENDANCE, "time", 0L);
//    }

    /**
     * 清除签到缓存数据
     */
//    public void clearAttendanceCache() {
//        SharedPreferenceUtils.clear(context, ATTENDANCE);
//    }

//    public boolean getInviteFlag() {
//        return (Boolean) SharedPreferenceUtils.get(context, INVITE_FLAG, "my_invite_flag", true);
//    }

    /**
     * 清除签到缓存数据
     */
//    public void setInviteFlag(boolean flag) {
//        SharedPreferenceUtils.put(context, INVITE_FLAG, "my_invite_flag", flag);
//    }

//    public boolean getWoFlowAlert() {
//        return (Boolean) SharedPreferenceUtils.get(context, WO_FLOW_ALERT, "woflow", false);
//    }

//    public void setWoFlowAlert(boolean isAlert) {
//        SharedPreferenceUtils.put(context, WO_FLOW_ALERT, "woflow", isAlert);
//    }

    /**
     * wo 流量弹窗时间 格式：20140728
     * */
//    public String getWoFlowShowTime() {
//        return (String) SharedPreferenceUtils.get(context, WO_FLOW_ALERT_TIME, "woflowtime", "");
//    }

    /**
     * wo 流量弹窗时间 格式：20140728
     * */
//    public void setWoFlowShowTime(String time) {
//        SharedPreferenceUtils.put(context, WO_FLOW_ALERT_TIME, "woflowtime", time);
//    }

    /**
     * 保存最后一次启动app的时间
     */
//    public boolean saveLatestLaunchTime() {
//        long t = System.currentTimeMillis();
//        String date = StringUtils.timeString(t);
//        String minutes = StringUtils.timeStringByMinutes(t);
//        SharedPreferences sp = context.getSharedPreferences(FORCE_ALERT, Context.MODE_PRIVATE);
//        // 如果两次存储时间不超过5分钟则不进行保存。
//        if (sp.getLong(PREF_CURRENTTIMEMILLIS, 0) != 0 && (t - sp.getLong(PREF_CURRENTTIMEMILLIS, 0) < 60 * 1000 * 5)) {
//            return false;
//        }
//
//        Editor editor = sp.edit();
//        editor.putLong(PREF_CURRENTTIMEMILLIS, t);// 保存启动精确时间
//        editor.putString(PREF_LAUNCH_DATE, date);// 保存启动时间（天）
//        editor.putString(PREF_LAUNCH_MINUTE, minutes);// 保存启动时间（分钟）
//        editor.commit();
//        return true;
//    }

    /**
     * 获取最后一次保存的启动app的时间(天)
     * 
     * @return
     */
//    public String getLatestLaunchDate() {
//        return (String) SharedPreferenceUtils.get(context, FORCE_ALERT, PREF_LAUNCH_DATE, "");
//    }

    /**
     * 获取最后一次保存的启动app的时间(分钟)
     * 
     * @return
     */
//    public String getLatestLaunchMinuite() {
//        return (String) SharedPreferenceUtils.get(context, FORCE_ALERT, PREF_LAUNCH_MINUTE, "");
//    }

    /**
     * 设置当前提醒间隔
     * 
     * @param day
     */
//    public void setForceAlertDistanceDays(String day) {
//        if (TextUtils.isEmpty(day) || day.trim().length() == 0) {
//            return;
//        }
//        SharedPreferenceUtils.put(context, FORCE_ALERT, PREF_ALERT_DAYS, day);
//    }

    /**
     * 获取当前提醒间隔
     * 
     * @return
     */
//    public String getCurrentForceAlertDistanceDays() {
//        return (String) SharedPreferenceUtils.get(context, FORCE_ALERT, PREF_ALERT_DAYS, "10000");
//    }

    /**
     * 
     * @param isFromPip
     */
    public void setPipFlag(boolean isFromPip) {
        SharedPreferenceUtils.put(context, PIP_FROM, "isFromPip", isFromPip);
    }

    public boolean isPipFlag() {
        return (Boolean) SharedPreferenceUtils.get(context, PIP_FROM, "isFromPip", false);
    }

    // 强制提醒 end

    /**
     * 向sharepreference中保存亮度和取出亮度
     */
    public void setBritness(float bri) {
        SharedPreferenceUtils.put(context, PLAYER_PARAMER, "britness", bri);
    }

    public float getBritness() {
        return (Float) SharedPreferenceUtils.get(context, PLAYER_PARAMER, "britness", 0f);
    }

    public boolean isShow3gDialog() {
        return (Boolean) SharedPreferenceUtils.get(context, DIALOG_3G, "show", true);
    }

    public void setShow3gDialog(boolean show) {
        SharedPreferenceUtils.put(context, DIALOG_3G, "show", show);
    }

    public void setWorldCupTime(String time) {
        SharedPreferences preferences = context.getSharedPreferences(WORLD_CUP_FUNCTION, Context.MODE_MULTI_PROCESS);
        preferences.edit().putString("world_cup_start_time", time).commit();
    }

//    public void setWorldCupFunc(boolean b) {
//        SharedPreferences preferences = context.getSharedPreferences(WORLD_CUP_FUNCTION, Context.MODE_MULTI_PROCESS);
//        preferences.edit().putBoolean("world_cup_func", b).commit();
//    }

//    public boolean getWorldCupFunc() {
//        SharedPreferences preferences = context.getSharedPreferences(WORLD_CUP_FUNCTION, Context.MODE_MULTI_PROCESS);
//        return preferences.getBoolean("world_cup_func", false);
//    }

    /**
     * 获取设备唯一标识
     * 
     * @param context
     * @return
     */
    public String getDeviceId(Context context) {
        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
        return sp.getString("letv_deviceId", null);
    }

    /**
     * 保存设备唯一标识
     * 
     * @param context
     * @param deviceId
     */
    public void setDeviceId(Context context, String deviceId) {
        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
        Editor editor = sp.edit();
        editor.putString("letv_deviceId", deviceId);
        editor.commit();
    }

    /*
     * 用户头像路径
     */
//    public void setPicture(String picture) {
//        SharedPreferences sp = context.getSharedPreferences(PERSONAL_CENTER_SP_NAME, Context.MODE_PRIVATE);
//        sp.edit().putString("picture", picture).commit();
//    }

//    public String getPicture() {
//        SharedPreferences sp = context.getSharedPreferences(PERSONAL_CENTER_SP_NAME, Context.MODE_PRIVATE);
//        return sp.getString("picture", "");
//    }

//    public File getDownloadDir() {
//        File file = new File(getDownloadLocation());
//
//        if (!file.exists()) {
//            file.mkdirs();
//        }
//        return file;
//    }

    // 联合登陆时需要用到的
    private static final String HAVELOGINPAGEKEY = "haveLoginKey";

//    public boolean getHaveLoginPage() {
//        SharedPreferences sp = context.getSharedPreferences(HAVELOGINPAGEKEY, Context.MODE_PRIVATE);
//        return sp.getBoolean("have_login_page", false);
//    }

//    public int getCurrentDownloadStream() {
//        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
//
//        int downloadStream = sp.getInt("downloadStream", LetvConstant.STREAM_LEVEL.STANDARD_STREAM);
//
//        return downloadStream;
//    }

//    public void setCurrentDownloadStream(int stream) {
//        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
//        sp.edit().putInt("downloadStream", stream).commit();
//    }

//    public void setDownloadPath(Context context, String path, String defaultPath) {
//        SharedPreferences sp = context.getSharedPreferences(WORLD_CUP_FUNCTION, Context.MODE_MULTI_PROCESS);
//        sp.edit().putString("download_path", path).commit();
//        sp.edit().putString("download_default_path", defaultPath).commit();
//    }

//    public String getDownloadPath(Context context) {
//        SharedPreferences sp = context.getSharedPreferences(WORLD_CUP_FUNCTION, Context.MODE_MULTI_PROCESS);
//        String path = sp.getString("download_path", "");
//        return path;
//    }

//    public void setHaveLoginPage(boolean flag) {
//        SharedPreferences sp = context.getSharedPreferences(HAVELOGINPAGEKEY, Context.MODE_PRIVATE);
//        Editor editor = sp.edit();
//        editor.putBoolean("have_login_page", flag);
//        editor.commit();
//    }

    /*
     * 用户积分
     */
    public void setScore(String score) {
        SharedPreferences sp = context.getSharedPreferences(PERSONAL_CENTER_SP_NAME, Context.MODE_PRIVATE);
        sp.edit().putString("score", score).commit();
    }

    public String getScore() {
        SharedPreferences sp = context.getSharedPreferences(PERSONAL_CENTER_SP_NAME, Context.MODE_PRIVATE);
        return sp.getString("score", "");
    }

    /**
     * 设置用户邮箱
     * 
     * @param email
     */
//    public void setEmail(String email) {
//        SharedPreferences sp = context.getSharedPreferences(PERSONAL_CENTER_SP_NAME, Context.MODE_PRIVATE);
//        sp.edit().putString("email", email).commit();
//    }

    /**
     * 得到用户邮箱
     * */
    public String getEmail() {
        SharedPreferences sp = context.getSharedPreferences(PERSONAL_CENTER_SP_NAME, Context.MODE_PRIVATE);
        return sp.getString("email", "");
    }

    /**
     * 设置用户邮箱
     * 
     * @param ssouid
     */
//    public void setSsouid(String ssouid) {
//        SharedPreferences sp = context.getSharedPreferences(PERSONAL_CENTER_SP_NAME, Context.MODE_PRIVATE);
//        sp.edit().putString("ssouid", ssouid).commit();
//    }

    /**
     * 得到用户邮箱
     * */
    public String getSsouid() {
        SharedPreferences sp = context.getSharedPreferences(PERSONAL_CENTER_SP_NAME, Context.MODE_PRIVATE);
        return sp.getString("ssouid", "");
    }

//    public boolean getClickLetvLogin() {
//        SharedPreferences sp = context.getSharedPreferences(HAVELOGINPAGEKEY, Context.MODE_PRIVATE);
//        return sp.getBoolean("click_letv_login", false);
//    }

//    public void setClickLetvLogin(boolean flag) {
//        SharedPreferences sp = context.getSharedPreferences(HAVELOGINPAGEKEY, Context.MODE_PRIVATE);
//        Editor editor = sp.edit();
//        editor.putBoolean("click_letv_login", flag);
//        editor.commit();
//    }

    /**
     * 设置已成功读取到数据 的时间 isSuccessTime 当天的时间,一天只获取一次数据
     */
//    public void saveTimeOfFloatInfoSuccess(String isSuccessTime) {
//        SharedPreferences sp = context.getSharedPreferences(GET_FLAOT_DATA_TIME, Context.MODE_PRIVATE);
//        Editor editor = sp.edit();
//        editor.putString("isSuccessTime", isSuccessTime);
//        editor.commit();
//    }

    /**
     * 已成功读取到数据的时间 isSuccessTime 获取数据的时间.
     */
//    public String getTimeOfFloatInfoSuccess() {
//        SharedPreferences sp = context.getSharedPreferences(GET_FLAOT_DATA_TIME, Context.MODE_PRIVATE);
//        return sp.getString("isSuccessTime", "invalid");
//    }

    /**
     * 离线广告开关 开关：true-开，false-关
     * */
//    public void setAdOfflineSwitch(boolean isOpen) {
//        SharedPreferenceUtils.put(context, HOME_PAGE, "ad_Offline", isOpen);
//    }

    /**
     * 离线广告开关 开关：true-开，false-关
     * */
//    public boolean isAdOfflineSwitch() {
//        return (Boolean) SharedPreferenceUtils.get(context, HOME_PAGE, "ad_Offline", true);
//    }

    /**
     * 设置卸载监听使能
     * 
     * @param enable
     */
//    public void setUninstallEnable(boolean enable) {
//        UninstalledObserver.setEnable(enable, context);
//    }

//    public String getContinuePayDateTime() {
//        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
//        return sp.getString("continue_pay_datetime", "");
//    }

//    public void setGameShow(boolean isShow) {
//        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
//        Editor editor = sp.edit();
//        editor.putBoolean("isGameShow", isShow);
//        editor.commit();
//    }

//    public void setLeMallShow(boolean isShow) {
//        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
//        Editor editor = sp.edit();
//        editor.putBoolean("isLeMallShow", isShow);
//        editor.commit();
//    }

//    public boolean isLeMallShow() {
//        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
//        return sp.getBoolean("isLeMallShow", true);
//    }

//    public boolean getGameShow() {
//        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
//        return sp.getBoolean("isGameShow", false);
//    }

    /**
     * 得到下载任务的标记，0-10，默认为-1
     * 
     * @return
     */
//    public int getDownloadFlag() {
//        SharedPreferences sp = context.getSharedPreferences(PUSH, Context.MODE_PRIVATE);
//        return sp.getInt("now_type", -1);
//    }

//    public void setFristApp() {
//        SharedPreferences sp = context.getSharedPreferences("fristapp", Context.MODE_MULTI_PROCESS);
//        sp.edit().putBoolean("frist", false).commit();
//    }

//    public boolean getFristApp() {
//        SharedPreferences sp = context.getSharedPreferences("fristapp", Context.MODE_MULTI_PROCESS);
//        return sp.getBoolean("frist", true);
//    }

    private static final String CACHE_TITLE = "cache_title";

    public void setCacheTitle(long id, String title) {
        SharedPreferences sp = context.getSharedPreferences(CACHE_TITLE, Context.MODE_MULTI_PROCESS);
        sp.edit().putString(String.valueOf(id), title).commit();
    }

    public String getCacheTitle(long id) {
        SharedPreferences sp = context.getSharedPreferences(CACHE_TITLE, Context.MODE_MULTI_PROCESS);
        String title = sp.getString(String.valueOf(id), "");
        return title;
    }

    public void setLesoNotification(boolean isOpen) {
        SharedPreferenceUtils.put(context, "false", "isSkip", isOpen);
    }

    public boolean getLesoNotification() {
        return context.getSharedPreferences("false", Context.MODE_PRIVATE).getBoolean(LESO_NOTIFICATION, true);
    }

    /**
     * 为了leso升级默认展现 保存版本号到本地。
     */
    public void setVersionCode4Leso(int VersionCodeId) {
        SharedPreferences sp = context.getSharedPreferences(VERSIONCODE, Context.MODE_PRIVATE);
        sp.edit().putInt("VersionCodeId4Leso", VersionCodeId).commit();
    }

    /**
     * 为了leso升级默认展现 获取保存的版本号
     */
    public int getVersionCode4Leso() {
        SharedPreferences sp = context.getSharedPreferences(VERSIONCODE, Context.MODE_PRIVATE);
        return sp.getInt("VersionCodeId4Leso", 0);
    }

    public void setLastAttendanceTime(long time) {
        SharedPreferences sp = context.getSharedPreferences(ATTENDANCE, Context.MODE_PRIVATE);
        Editor editor = sp.edit();
        editor.putLong("time", time);
        editor.commit();
    }

    public void setInviteVisibleFlag(boolean flag) {

        SharedPreferences sp = context.getSharedPreferences(INVITE_VISIBLE_FLAG, Context.MODE_PRIVATE);
        sp.edit().putBoolean("invite_visible_flag", flag).commit();
    }

    /*
     * 从dialog对话框数据中获取数据，判断是否应该弹出邀请对话框
     */
    public boolean getInviteVisibleFlag() {

        SharedPreferences sp = context.getSharedPreferences(INVITE_VISIBLE_FLAG, Context.MODE_PRIVATE);
        return sp.getBoolean("invite_visible_flag", false);
    }

    /*
     * 过期付费提醒弹框，一天只弹一次，读取/保存已弹框的当天本地时间的日期 continue_pay_datetime 续费提醒日期 年月日
     * today_is_expired 即将过期当天是否过期 0:今天尚未弹出过 -1：今天即将过期已弹出 1：今天已经过期已弹出
     * 会员到期7天、3天、当天，到期后3天、7天弹出。 过期当天，过期前提示今天就要过期了，或今天已经过期了。
     */
    public void setContinuePayDateTime(String datetime, int expireDays) {
        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
        Editor editor = sp.edit();
        editor.putString("continue_pay_datetime", datetime);
        editor.putInt("expire_days", expireDays);
        editor.commit();
    }

    public void setContinuePayDateTime(String datetime) {
        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
        Editor editor = sp.edit();
        editor.putString("continue_pay_datetime", datetime);
        editor.putInt("expire_days", -101);
        editor.commit();
    }

    public void setExpireDays(int expireDays) {
        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
        Editor editor = sp.edit();
        editor.putInt("expire_days", expireDays);
        editor.commit();
    }

    public int getExpireDays() {
        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
        return sp.getInt("expire_days", -101);
    }

    /**
     * 是否是高级VIP
     * */
    public boolean isSViP() {
        int vipLevel = getVipLevel();
        return vipLevel == 2;
    }

    public void setNotifyIdLocal(int id) {
        SharedPreferences sp = context.getSharedPreferences(NOTIFY_ID_LOCAL_FORCE, Context.MODE_PRIVATE);
        sp.edit().putInt("local_id", id).commit();
    }

    public int getNotifyIdLocal() {
        SharedPreferences sp = context.getSharedPreferences(NOTIFY_ID_LOCAL_FORCE, Context.MODE_PRIVATE);
        return sp.getInt("local_id", 0);
    }

    public void setNotifyIdForcePush(int id) {
        SharedPreferences sp = context.getSharedPreferences(NOTIFY_ID_LOCAL_FORCE, Context.MODE_PRIVATE);
        sp.edit().putInt("push_id", id).commit();
    }

    public int getNotifyIdForcePush() {
        SharedPreferences sp = context.getSharedPreferences(NOTIFY_ID_LOCAL_FORCE, Context.MODE_PRIVATE);
        return sp.getInt("push_id", 0);
    }

    /**
     * 得到TV推广markid
     * */
    public String getTVSpreadMarkForV551() {
        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
        return sp.getString("TVSpreadMark551", "0");
    }

    /**
     * 设置TV推广markid
     * */
    public void setTVSpreadMarkForV551(String TVSpreadMark) {
        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
        sp.edit().putString("TVSpreadMark551", TVSpreadMark).commit();
    }

    /**
     * 得到ua
     */
    public String getUA() {
        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
        return sp.getString("User-agent", "");
    }

    /**
     * 设置ua
     */
    public void setUA(String ua) {
        SharedPreferences sp = context.getSharedPreferences(SETTINGS, Context.MODE_MULTI_PROCESS);
        sp.edit().putString("User-agent", ua).commit();
    }

    /**
     * 获取定位纬度
     * 
     * @return
     */
    public String getLocationLatitude() {
        return (String) SharedPreferenceUtils.get(context, BD_LOCATION, "mlocationLatitude", "");
    }

    /**
     * 保存定位纬度
     * 
     * @param latitude
     */
    public void setLocationLatitude(String latitude) {
        SharedPreferenceUtils.put(context, BD_LOCATION, "mlocationLatitude", latitude);
    }

    /**
     * 获取定位精度
     * 
     * @return
     */
    public String getLocationLongitude() {
        return (String) SharedPreferenceUtils.get(context, BD_LOCATION, "mlocationLongitude", "");
    }

    /**
     * 保存定位精度
     * 
     * @param Longitude
     */
    public void setLocationLongitude(String Longitude) {
        SharedPreferenceUtils.put(context, BD_LOCATION, "mlocationLongitude", Longitude);
    }

    /**
     * 获取定位城市
     * 
     * @return
     */
    public String getLocationCity() {
        return (String) SharedPreferenceUtils.get(context, BD_LOCATION, "locationCity", "");
    }

    /**
     * 保存定位城市
     * 
     * @param city
     */
    public void setLocationCity(String city) {
        SharedPreferenceUtils.put(context, BD_LOCATION, "locationCity", city);
    }
    /**
     * 获取(是否开启)定位状态
     * 
     * @return
     */
    public boolean getLocationState() {
        return (Boolean) SharedPreferenceUtils.get(context, BD_LOCATION, "locationState", false);
    }

    /**
     * 设置定位状态
     * 
     * @param state
     */
    public void setLocationState(boolean state) {
        SharedPreferenceUtils.put(context, BD_LOCATION, "locationState", state);
    }

    /**
     * 设置liteApp下载完成标识
     * by pangzhen
     */
    public void setLiteDownloadCompleted(){
        SharedPreferenceUtils.put(context, LITE_DOWNLOAD, LITE_DOWNLOAD_COMPLETED,true);
    }

    /**
     * 获取liteApp是否已经下载的标示
     * by pangzhen
     * @return
     */
    public boolean  getLiteDownloadCompleted(){
        return (Boolean)SharedPreferenceUtils.get(context,LITE_DOWNLOAD, LITE_DOWNLOAD_COMPLETED,false);
    }

    /**
     * 设置liteApp的下载路径
     * by pangzhen
     * @param mLitePath
     */
    public void setLiteDownLoadPath(String mLitePath){
        SharedPreferenceUtils.put(context,LITE_DOWNLOAD,LITE_DOWNLOAD_PATH,mLitePath);
    }

    /**
     * 获取liteApp下载的路径
     * by pangzhen
     * @return
     */
    public String getLiteDownLoadPath(){
        return (String)SharedPreferenceUtils.get(context,LITE_DOWNLOAD,LITE_DOWNLOAD_PATH,"");
    }

    /**
     * 设置下载LiteApp的名字
     * by pangzhen
     * @param mLiteAppName
     */
    public  void setLiteDownLoadName(String mLiteAppName){
        SharedPreferenceUtils.put(context,LITE_DOWNLOAD,LITE_DOWNLOAD_NAME,mLiteAppName);
    }

    /**
     * 获取已经下载的LiteApp的名字
     * by pangzhen
     * @return
     */
    public String getLiteDownLoadName(){
        return (String)SharedPreferenceUtils.get(context,LITE_DOWNLOAD,LITE_DOWNLOAD_NAME,"");
    }





}
